import 'babel-polyfill'
import Vue from 'vue'
import Router from 'vue-router'

/* home */
// const Index = () => import('page/home/index')
import Index from '@/views/home/index'
import Search from '@/views/search/search'
import GoodsList from '@/views/search/goodsList'
import Supplier from '@/views/supplier/supplier'
import OrderList from '@/views/order/orderList'
import ShareList from '@/views/order/shareList'
import OrderDetails from '@/views/order/orderDetails'
import RefundDetails from '@/views/refund/refundDetails'
import RefundApply from '@/views/refund/refundApply'
import fillRefundInfo from '@/views/refund/fillRefundInfo'
import addEntAuth from '@/views/certification/addEntAuth'
import checkEntAuth from '@/views/certification/checkEntAuth'
import Test from '@/views/refund/test'
import testList from '@/views/search/testList'
import Favorites from '@/views/member/favorites'
import applyInvoice from '@/views/invoice/applyInvoice'
import askInvoiceInfo from '@/views/invoice/askInvoiceInfo'
import invoiceSetting from '@/views/invoice/invoiceSetting'
import chooseInvoice from '@/views/invoice/chooseInvoice'
import invoiceAddress from '@/views/invoice/invoiceAddress'
import addInvoiceInfo from '@/views/invoice/addInvoiceInfo'
/* cms */

/* member */
// import Login from 'page/member/login'
// import Address from 'page/member/address'
// /* member */

// /* shop */
// import List from 'page/shop/list'
// import Product from 'page/shop/product'
// import CreateOrder from 'page/shop/createOrder'
// import Pay from 'page/shop/pay'
// import PaySuccess from 'page/shop/paySuccess'

/* shop */

const appRouter = {
  // mode: 'history',
  // base: '/m/',
  routes: [
    {
      path: '',
      redirect: '/index'
    },
    {
      path: '/index',
      name: 'index',
      component: Index,
      meta: {
        keepAlive: true,
        isBack: true // 用于判断上一个页面是哪个
      }
    },
    {
      path: '/search',
      name: 'search',
      component: Search,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/goodsList',
      name: 'goodsList',
      component: GoodsList,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/supplier',
      name: 'supplier',
      component: Supplier,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/orderList',
      name: 'orderList',
      component: OrderList,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/shareList',
      name: 'shareList',
      component: ShareList,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/orderDetails',
      name: 'orderDetails',
      component: OrderDetails,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/refundApply',
      name: 'refundApply',
      component: RefundApply,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/refundDetails',
      name: 'refundDetails',
      component: RefundDetails,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/fillRefundInfo',
      name: 'fillRefundInfo',
      component: fillRefundInfo,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/test',
      name: 'test',
      component: Test,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/testList',
      name: 'testList',
      component: testList,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/addEntAuth',
      name: 'addEntAuth',
      component: addEntAuth,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/checkEntAuth',
      name: 'checkEntAuth',
      component: checkEntAuth,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/favorites',
      name: 'favorites',
      component: Favorites,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/applyInvoice',
      name: 'applyInvoice',
      component: applyInvoice,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/askInvoiceInfo',
      name: 'askInvoiceInfo',
      component: askInvoiceInfo,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/invoiceSetting',
      name: 'invoiceSetting',
      component: invoiceSetting,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/chooseInvoice',
      name: 'chooseInvoice',
      component: chooseInvoice,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/invoiceAddress',
      name: 'invoiceAddress',
      component: invoiceAddress,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/addInvoiceInfo',
      name: 'addInvoiceInfo',
      component: addInvoiceInfo,
      meta: {
        keepAlive: false
      }
    }

    // {
    //   path: '/list',
    //   name: 'list',
    //   component: List,
    //   meta: {
    //     keepAlive: true,
    //     isBack: false //用于判断上一个页面是哪个
    //   }
    // },
    // {
    //   path: '/product/:id',
    //   name: 'product',
    //   component: Product,
    //   meta: {
    //     keepAlive: false
    //   }
    // },
    // {
    //   path: '/createorder',
    //   name: 'createorder',
    //   component: CreateOrder,
    //   meta: { keepAlive: false }
    // },
    // {
    //   path: '/address/:id?',
    //   name: 'address',
    //   component: Address,
    //   meta: { keepAlive: false }
    // },
    // {
    //   path: '/pay',
    //   name: 'pay',
    //   component: Pay,
    //   meta: { keepAlive: false }
    // },
    // {
    //   path: '/paysuccess',
    //   name: 'paysuccess',
    //   component: PaySuccess,
    //   meta: { keepAlive: false }
    // }
  ]
}
import sunnie from '@/router/sunnie'
sunnie.map(i => {
  appRouter.routes.push(i)
}) // 部署线上记得吧这行代码注释掉
Vue.use(Router)
export default new Router(appRouter)
